/**
 * Copyright ©2012-2018 HopeHaiyang Corporation, All Rights Reserved
 * http://www.wuhanhope.com
 */
package hope.platform.data.web;

import hope.platform.data.domain.WarningKind;
import hope.platform.data.server.data.header.WarningKindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * class info
 *
 * @author hujia
 *         Create at 2018/7/20 16:05
 */
@RestController
@RequestMapping("/warningKind")
public class WarningKindController {

    @Autowired
    private WarningKindService service;

    @RequestMapping(method = RequestMethod.POST)
    public WarningKind addWarningKind(@RequestBody WarningKind warningKind) throws Exception {
        return service.addWarningKind(warningKind);
    }

    @RequestMapping(value = "/all", method = RequestMethod.GET)
    public List<WarningKind> getAll() throws Exception {
        return service.getAll();
    }

    @RequestMapping(value = "/warningType/{warningType}", method = RequestMethod.GET)
    public WarningKind getByWarningType(@PathVariable String warningType) throws Exception {
        return service.getByWarningType(warningType);
    }
}
